<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>RegDelete</title>
<meta name="description" content="Use RegDelete in this free scripting language to easily remove unwanted registry entries. Use RegRead/Write to retrieve, add, and modify entries.">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>RegDelete</h1>

<p>Deletes a subkey or value from the registry.</p>

<pre class="Syntax">RegDelete, RootKey\SubKey [, ValueName]  <em>; v1.1.21+</em>
RegDelete, RootKey, SubKey [, ValueName]</pre>
<h3>Parameters</h3>
<dl>

  <dt>RootKey</dt>
  <dd><p>Must be either HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, or HKEY_CURRENT_CONFIG (or the abbreviations for each of these, such as HKLM). To access a remote registry, prepend the computer name and a colon (or in v1.1.21+, a slash), as in this example: <code>\\workstation01:HKEY_LOCAL_MACHINE</code></p></dd>

  <dt>SubKey</dt>
  <dd><p>The name of the subkey (e.g. Software\SomeApplication).</p></dd>
  
  <dt>RootKey\SubKey <span class="ver">[v1.1.21+]</span></dt>
  <dd><p>If <em>RootKey</em> is followed immediately by a slash (<code>\</code>), <em>RootKey</em> and <em>SubKey</em> are merged into a single parameter.</p></dd>

  <dt>ValueName</dt>
  <dd><p>The  name of the value to delete. <strong>If omitted, the entire <em>SubKey</em> will be deleted</strong>. To delete <em>Subkey</em>'s default value -- which is the value displayed as &quot;(Default)&quot; by RegEdit -- use the phrase <code>AHK_DEFAULT</code> for this parameter.</p></dd>

</dl>
<h3>ErrorLevel</h3>
<p><span class="ver">[v1.1.04+]</span> This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p>
<p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p><a href="../Variables.htm#LastError">A_LastError</a> is set to the result of the operating system's GetLastError() function.</p>
<h3>Remarks</h3>
<p>Deleting from the registry is potential dangerous - please exercise caution!</p>
<p>To retrieve and operate upon multiple registry keys or values, consider using a <a href="LoopReg.htm">registry-loop</a>.</p>
<p>For details about how to access the registry of a remote computer, see the remarks in <a href="LoopReg.htm">registry-loop</a>.</p>
<p>To delete entries from the 64-bit sections of the registry in a 32-bit script or vice versa, use <a href="SetRegView.htm">SetRegView</a>.</p>

<h3>Related</h3>
<p><a href="RegRead.htm">RegRead</a>, <a href="RegWrite.htm">RegWrite</a>, <a href="LoopReg.htm">Registry-loop</a>, <a href="SetRegView.htm">SetRegView</a>, <a href="IniDelete.htm">IniDelete</a></p>
<h3>Example</h3>
<pre class="NoIndent">RegDelete, HKEY_LOCAL_MACHINE, Software\SomeApplication, TestValue
RegDelete, HKEY_LOCAL_MACHINE\Software\SomeApplication, TestValue  <em>; Requires v1.1.21+</em></pre>

</body>
</html>
